import { _decorator, Component, find, Node } from 'cc';
import { MainLlogic } from './MainLlogic';
const { ccclass, property } = _decorator;

@ccclass('Share')
export class Share extends Component {

    mainLogic:Node = null
    start() {

        this.mainLogic = find('Canvas/MainLogic')
        // var id = 'fPuCHgtRTT6kAY08QaN5dg==' // 通过 MP 系统审核的图片编号
        // var url = 'https://mmocgame.qpic.cn/wechatgame/dDicxlMkOQDfiaALpybrWIRpJicYE2TGLP07BSickGyWLcnyTyKOElY3IiaPI76Xabvgz/0' // 通过 MP 系统审核的图片地址
        
        this.node.on(Node.EventType.TOUCH_START,(e)=>{
            wx.shareAppMessage({
                title:'放松下来走的更远',
                // imageUrlId: id,
                // imageUrl: url,
            })
        },this)
    }

    update(deltaTime: number) {
        if(this.mainLogic.getComponent(MainLlogic).gameOver&&this.mainLogic.getComponent(MainLlogic).isRun){
            this.node.destroy()
        }
    }
}



